/*
Copyright (C) 2022-2024 Inspur Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/
package controller

import (
	"icep/auth"
	"icep/common/http"

	"github.com/emicklei/go-restful"
)

func (ic *IcepController) DebugChain(req *restful.Request, resp *restful.Response) {
	tenantId := auth.GetCurrentTenantId(req)
	client := ic.IcepService.GetChainClient(tenantId)
	go func() {
		txId, payload := client.PutFileEvidence("file_a", "asdfasdfasdfasdf")
		log.Infof("txId: %s, payload: %s", txId, payload)
		payload = client.GetFileEvidence("file_a")
		log.Infof("payload: %s", payload)

		txId, payload = client.PutObtainEvidence("obtain_a", "asdfasdfhhh11111")
		log.Infof("txId: %s, payload: %s", txId, payload)
		payload = client.GetObtainEvidence("obtain_a")
		log.Infof("payload: %s", payload)
	}()

	http.Ok(resp, "执行成功")
}
